<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusChargeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_charge', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('card_num')->nullable()->comment('卡号');
            $table->string('login_name')->nullable()->comment('e充电登录名');
            $table->integer('serials_num')->nullable()->comment('流水号');
            $table->string('VIN_num')->default('')->comment('VIN编码');
            $table->string('license_plate_num')->nullable()->comment('车牌号');
            $table->integer('user_num')->nullable()->comment('用户编号');
            $table->string('member_num')->nullable()->comment('成员名称');
            $table->string('member_dept')->nullable()->comment('成员所属机构');
            $table->string('department')->nullable()->comment('所属组织机构');
            $table->string('charge_type')->nullable()->comment('充电方式');
            $table->dateTime('order_created_at')->nullable()->comment('订单创建时间');
            $table->string('order_status')->nullable()->comment('订单状态');
            $table->string('pay_type')->nullable()->comment('支付方式');
            $table->string('charging_pile_num')->nullable()->comment('充电桩编号');
            $table->string('charging_station')->nullable()->comment('充电站');
            $table->decimal('trading_power', 10, 2)->nullable()->comment('交易电量');
            $table->decimal('trading_amt', 10, 2)->nullable()->comment('交易金额');
            $table->decimal('act_trading_amt', 10, 2)->nullable()->comment('实扣交易金额');
            $table->decimal('act_service_fee', 10, 2)->nullable()->comment('实扣服务费');
            $table->decimal('power_fee', 10, 2)->nullable()->comment('电费');
            $table->decimal('service_fee', 10, 2)->nullable()->comment('服务费');
            $table->decimal('discounted_amt', 10, 2)->nullable()->comment('优惠金额');
            $table->decimal('deduction_amt', 10, 2)->nullable()->comment('E卡抵扣金额');
            $table->dateTime('charging_start_at')->nullable()->comment('充电开始时间');
            $table->dateTime('charging_end_at')->nullable()->comment('充电结束时间');
            $table->string('is_invoiced')->nullable()->comment('是否开票');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_charge');
    }
}
